package com.atguigu;

import java.sql.*;

public class PhoenixJdbc_API {
    public static void main(String[] args) throws SQLException {
        //1.获取连接
        Connection connection = DriverManager.getConnection("jdbc:phoenix:hadoop102,hadoop103,hadoop104:2181");

        //2.获取语句预执行者
        PreparedStatement pstm = connection.prepareStatement("select * from student");

        //3.执行sql获取结果
        ResultSet resultSet = pstm.executeQuery();

        //4.打印结果
        while (resultSet.next()){
            System.out.println(resultSet.getString(1)+"-"+resultSet.getString(2)+"-"+resultSet.getString(3));
        }

        //5.关闭资源
        pstm.close();
        connection.close();

    }
}
